home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / string / strspn.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-05  |  363 b   |  27 lines

  1. #include <string.h>
  2.  
  3. /************************************************************************/
  4.  
  5. #undef strspn
  6.  
  7. size_t strspn(const char *s1, const char *s2)
  8.  
  9. {
  10.   size_t i;
  11.   const unsigned char *c1=s1;
  12.   const unsigned char *c2;
  13.  
  14.   for(i=0;;i++)
  15.     {
  16.       c2=s2;
  17.       while(*c2!='\0'&&c1[i]!=*c2)
  18.     {
  19.       c2++;
  20.     }
  21.       if(*c2=='\0')
  22.     {
  23.       return i;
  24.     }
  25.     }
  26. }
  27.